<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"   
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>	   	
	   	<f:viewParam name="firstResult" value="#{bulletinList.firstResult}"></f:viewParam>
	   	<f:viewParam name="maxResults" value="#{bulletinList.maxResults}"></f:viewParam>
	   	<f:event listener="#{qualificationClassList.setMaxResults(99999)}" type="preRenderView"></f:event>
	   	<f:viewParam name="moduleName" value="公告统计"></f:viewParam>
	   	<f:viewParam name="agentServiceId" value="#{qualificationConditionBean.agentServiceId}"></f:viewParam>
	   	<f:viewParam name="projectName" value="#{bulletinList.projectName}"></f:viewParam>
	   	<f:viewParam name="buyerName" value="#{bulletinList.buyerName}"></f:viewParam>
		<f:viewParam name="qClassId" value="#{qualificationConditionBean.qualificationClassId}"></f:viewParam>
		<f:viewParam name="sectorId" value="#{qualificationConditionBean.sectorId}"></f:viewParam>
		<f:viewParam name="childSectorSno" value="#{qualificationConditionBean.childSectorSno}"></f:viewParam>
		<f:viewParam name="certLevel" value="#{qualificationConditionBean.certLevel}"></f:viewParam>
		<f:viewParam name="tradeStatus" value="#{bulletinList.tradeStatus}"></f:viewParam>
		<f:viewParam name="successSupplier" value="#{bulletinList.successSupplier}"></f:viewParam>
   	</f:metadata>
   
   	<ui:define name="content">
   
		<h:form id="searchForm">	
			<div style="height:150px;margin-left:10px">				
				<p:outputLabel value="项目名称："></p:outputLabel>				
				<p:inputText value="#{bulletinList.projectName}"></p:inputText>
				#{'    '}
				<p:outputLabel value="采购人："></p:outputLabel>				
				<p:inputText value="#{bulletinList.buyerName}"></p:inputText>
				<p:outputLabel value="中选中介：" rendered="false"></p:outputLabel>				
				<p:inputText value="#{bulletinList.successSupplier}" rendered="false"></p:inputText><br/>
				<p:outputLabel value="服务事项："></p:outputLabel>
				<p:selectOneMenu value="#{qualificationConditionBean.agentServiceId}" filter="true">
					<f:selectItem
								itemLabel="--请选择--"
								itemValue="#{null}"
							/>
							<f:selectItems
								value="#{agentServiceList.resultList}"
								var="_agentService"
								itemLabel="#{_agentService.name}"
								itemValue="#{_agentService.id}"
							></f:selectItems>
				</p:selectOneMenu>	
				<div style="margin-top:10px;">
					<p:outputLabel value="资质范围：" style="display:inline-bloack;margin-top:10px;"></p:outputLabel>
					<p:outputLabel>
						<p:selectOneMenu
							value="#{qualificationConditionBean.qualificationClassId}"
						>
							<f:selectItem
								itemLabel="--请选择--"
								itemValue="#{null}"
							/>
							<f:selectItems
								value="#{qualificationClassList.resultList}"
								var="_class"
								itemLabel="#{_class.name}"
								itemValue="#{_class.id}"
							>
							</f:selectItems>
							<f:ajax render="sectorId certLevel"></f:ajax>
						</p:selectOneMenu>#{' '}
						<p:selectOneMenu
							id="sectorId"
							widgetVar="sectorId"
							value="#{qualificationConditionBean.sectorId}"
						>
							<f:selectItem
								itemLabel="--请选择--"
								itemValue="#{null}"
							/>
							<f:selectItems
								value="#{qualificationConditionBean.sectors}"
								var="_sector"
								itemLabel="#{_sector.sectorName}"
								itemValue="#{_sector.id}"
							></f:selectItems>
							<f:ajax event="change" listener="#{qualificationConditionBean.initChildSectors()}" render="childSectorId"></f:ajax>
						</p:selectOneMenu>
						
						<p:selectOneMenu
							id="childSectorId"
							widgetVar="childSectorId"
							value="#{qualificationConditionBean.childSectorSno}"
						>
							<f:selectItem
								itemLabel="--请选择--"
								itemValue="#{null}"
							/>
							<f:selectItems
								value="#{qualificationConditionBean.childSectors}"
								var="_childsector"
								itemLabel="#{_childsector.sectorName}"
								itemValue="#{_childsector.sno}"
							></f:selectItems>
						</p:selectOneMenu>
					</p:outputLabel>
					<ui:remove>
						<p:outputLabel value="资质等级："></p:outputLabel>
						<p:selectOneMenu
							id="certLevel"
							value="#{qualificationConditionBean.certLevel}"
						>
							<f:selectItem
								itemLabel="--请选择--"
								itemValue="#{null}"
							/>
							
							<f:selectItems
								value="#{qualificationConditionBean.qualificationLevels}"
								var="_level"
								itemLabel="#{_level.name}"
								itemValue="#{_level.value}"
							></f:selectItems>						
						</p:selectOneMenu>
					</ui:remove>
				
				</div>
						
				<div class="actionButtons" style="margin-top:10px;">
					<p:commandButton value="查询" ajax="false"  action="BulletinStatList.xhtml?faces-redirect=true&amp;includeViewParams=true&amp;firstResult=0" styleClass="blue-int"></p:commandButton>
					#{'    '}
					<p:button value="重置" outcome="BulletinStatList.xhtml"></p:button>
				</div>				
				<div class="clearbt"></div>
			</div>
			<p:panel id="searchResult" header="公告统计">
				<p:dataTable value="#{bulletinList.resultList}" var="_bulletin" varStatus="_status">
					
					<p:column>
						<f:facet name="header">项目名称</f:facet>
						<h:outputText value="#{_bulletin.projectName}" title="#{_bulletin.projectName}" />
					</p:column>
					<p:column>
						<f:facet name="header">采购人</f:facet>
						<h:outputText value="#{_bulletin.buyer.cnname}" title="#{_bulletin.buyer.cnname}" />
					</p:column>
					
					<p:column>
						<f:facet name="header">业务类型</f:facet>
						#{_bulletin.bulletinReqStr}
					</p:column>
					
					<p:column width="60">
						<f:facet name="header">选取方式</f:facet>
						#{_bulletin.wayOfChoose.typeName}
					</p:column>
					
					<p:column >
						<f:facet name="header">中选机构</f:facet>
						#{_bulletin.successTrade.supplier.cnname}
					</p:column>
					
					<p:column width="130">
						<f:facet name="header">选取时间</f:facet>
						<h:outputText value="#{_bulletin.chooseTime}"  >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm"/>
						</h:outputText>
					</p:column>
					<p:column >
						<f:facet name="header">服务金额(元)</f:facet>
						#{_bulletin.price}
					</p:column>
					
				</p:dataTable>
			</p:panel>
			
			<ui:include src="/WEB-INF/templates/manage/pagination.xhtml">
				<ui:param name="entityList" value="#{bulletinList}" />
			</ui:include>
			
		</h:form>
      
   	</ui:define>
</ui:composition>
